const images = [
	{
		id: 'EYE_MASK',
		url: 'https://temp.aifaceswap.io/petswitch/eye-mask-d8c62087c14dd378041aa06c74da8a1b.webp',
	},
	{
		id: 'MOUTH_MASK',
		url: 'https://temp.aifaceswap.io/petswitch/mouth-mask-db63225ea7be58d9412ff86d9e603b23.webp',
	},
]

const getImage = (imgObj) =>
	new Promise((resolve, reject) => {
		const image = new Image()

		image.onload = (e) => {
			resolve(image)
		}

		image.onerror = (e) => {
			reject(Error('Network Error'))
		}

		image.src = imgObj.url
		image.id = imgObj.id
	})

const loadImages = (images) => images.map(getImage)

export default Promise.all(loadImages(images))
